'''
Created on Oct 15, 2014

@author: azhelezny
'''
def getCGPercentage(dnaString):
    cgCount = dnaString.count('G') + dnaString.count('C')
#    print("Count:"+format(cgCount)+" length:"+format(len(dnaString)))
    return float(cgCount)*100.000/float(len(dnaString)) 

inputFile = open("D:\\fasta.input")
customDict = {}
fileString=inputFile.readline()
while 1:
    if(not fileString):
        break
    rName = fileString.replace("\n","").replace(">","")
    print("Rname:"+rName)
    rDna = ""
    while 1:
        fileString = inputFile.readline().replace("\n","")
        if(not fileString or fileString.count(">") != 0):
            break
        rDna += fileString
    print(rDna)
    customDict[rName]=getCGPercentage(rDna)
maxString = str
maxPercentage = -1.001
for fasta in customDict.keys():
    if(customDict[fasta] > maxPercentage):
        maxPercentage = customDict[fasta]
        maxString = fasta
print(maxString+"\n"+format(maxPercentage))

